package models

import (
	"gitee.com/lzqysoft/framework/common/tool"
	"time"
	"gitee.com/lzqysoft/framework/common/uuid"
)

type Authority struct {
	Id         string `xorm:"not null pk index unique VARCHAR(64)"`
	Onwer      string `xorm:"VARCHAR(64)"`
	Group      string `xorm:"VARCHAR(64)"`
	Creater    string `xorm:"VARCHAR(64)"`
	CreateAt   int64  `xorm:"BIGINT"`
	CreateOrg  string `xorm:"VARCHAR(64)"`
	Updater    string `xorm:"VARCHAR(64)"`
	UpdateAt   int64  `xorm:"BIGINT"`
	Deleter    string `xorm:"VARCHAR(64)"`
	DeleteAt   int64  `xorm:"BIGINT"`
	Isdelete   string `xorm:"VARCHAR(2)"`
	Status     string `xorm:"VARCHAR(2)"`
	Remark     string `xorm:"VARCHAR(255)"`
	Operation int    `xorm:"INTEGER"`
	Obligate3  string `xorm:"VARCHAR(64)"`
	Obligate2  string `xorm:"VARCHAR(64)"`
	Obligate   string `xorm:"VARCHAR(64)"`
	ModuleId   string `xorm:"not null index VARCHAR(32)"`
	ModuleCode string `xorm:"index VARCHAR(32)"`
	Category   string `xorm:"VARCHAR(2)"`                 // 00、接口 01、菜单 02、按钮 ...
	Name       string `xorm:"VARCHAR(32)"`
	Code       string `xorm:"VARCHAR(32)"`
}
func (v *Authority) TableName() string {
	return "base_authority"
}
func (v *Authority) BeforeInsert(){
	v.Id = uuid.UUID()
	v.CreateAt = time.Now().Unix()
	v.UpdateAt = time.Now().Unix()
}

func (v Authority) Convert2Map() map[string]interface{} {
	return tool.Struct2Map(v)
}
